﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Paradoxlost.WebParts.Microsoft.Exchange;

namespace Paradoxlost.WebParts.Calendar
{
	public class CalendarItem
	{
		private CalendarItemType item;

		public CalendarItem()
		{
		}

		public CalendarItem(CalendarItemType calendarItem)
		{
			this.item = calendarItem;
			if (this.item.IsRecurring)
			{
				this.Id = this.item.ItemId.ChangeKey;
			}
		}

		public string Id { get; set; }

		public string ItemId { get { return this.item.ItemId.Id; } }

		public DateTime Start { get { return this.item.Start; } }

		public DateTime End { get { return this.item.End; } }

		public string Subject { get { return this.item.Subject; } }

		public string Location { get { return this.item.Location; } }

		public string Body { get { return (this.item.Body != null) ? this.item.Body.Value : null; } }

		public bool AllDay { get { return this.item.IsAllDayEvent; } }

		public bool Recurring { get { return this.item.IsRecurring; } }

		public int Color { get { return (this.item.ExtendedProperty != null && this.item.ExtendedProperty.Length > 0) ? int.Parse((string)this.item.ExtendedProperty[0].Item) : 0; } }

		public string[] Categories { get { return this.item.Categories; } }
	}
}
